home *** CD-ROM | disk | FTP | other *** search
File List | 1986-10-19 | 5.5 KB | 198 lines |
- ' ***************
- ' *** KEY.LST ***
- ' ***************
- '
- DEFWRD "a-z"
- '
- > PROCEDURE return.key
- ' *** wait for <Return>
- ' *** after pressing any other key, flashing 'RETURN' is turned off
- ' *** uses Standard-Globals
- LOCAL w1$,w2$,temp$,in$
- CLR in$
- REPEAT
- UNTIL INKEY$=""
- GET 0,scrn.y.max-char.height,scrn.x.max,scrn.y.max,temp$
- w1$="<RETURN>"
- w2$=SPACE$(8)
- PRINT AT(scrn.col.max/2-3,scrn.lin.max);w1$;
- WHILE in$="" ! wait for any key
- PAUSE 30
- SWAP w1$,w2$
- PRINT AT(scrn.col.max/2-3,scrn.lin.max);w1$;
- in$=INKEY$
- WEND
- PUT 0,scrn.y.max-char.height,temp$,3 ! restore screen
- WHILE in$<>return$ ! wait for <Return>
- in$=INKEY$
- WEND
- RETURN
- ' **********
- '
- > PROCEDURE bell.return.key
- ' *** same as Procedure Return.key, but with bell-sound
- ' *** bell turned off after pressing any key
- ' *** uses Standard-Globals and Procedure Return.key
- LOCAL w1$,w2$,temp$,b1$,b2$,in$
- CLR in$
- REPEAT
- UNTIL INKEY$=""
- GET 0,scrn.y.max-char.height,scrn.x.max,scrn.y.max,temp$
- w1$="<RETURN>"
- w2$=SPACE$(8)
- b1$=bel$
- b2$=""
- PRINT AT(scrn.col.max/2-3,scrn.lin.max);w1$;b1$;
- WHILE in$="" ! wait for any key
- PAUSE 30
- SWAP w1$,w2$
- SWAP b1$,b2$
- PRINT AT(scrn.col.max/2-3,scrn.lin.max);w1$;b1$;
- in$=INKEY$
- WEND
- PUT 0,scrn.y.max-char.height,temp$,3
- IF in$<>return$
- @return.key ! switch bell off, but wait for <Return>
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE key.click(switch!)
- ' *** switch key-click on/off
- IF switch!
- SPOKE &H484,BSET(PEEK(&H484),0) ! keyclick on
- ELSE
- SPOKE &H484,BCLR(PEEK(&H484),0) ! keyclick off
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE key.repeat(switch!)
- ' *** switch key-repeat on/off
- IF switch!
- SPOKE &H484,BSET(PEEK(&H484),1) ! key-repeat on
- ELSE
- SPOKE &H484,BCLR(PEEK(&H484),1) ! key-repeat off
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE caps(switch!)
- ' *** switch CapsLock on/off
- IF switch!
- ~BIOS(11,BSET(BIOS(11,-1),4)) ! CapsLock on
- ELSE
- ~BIOS(11,BCLR(BIOS(11,-1),4)) ! CapsLock off
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE stop.key
- ' *** temporarily stop program after : <S> , <s> of <Control> <S>
- ' *** continue program after any keypress or click
- ' *** use in loop where this Procedure is called regularly
- LOCAL in$
- in$=INKEY$
- IF INSTR("Ss"+CHR$(19),in$)>0
- REPEAT
- UNTIL INKEY$=""
- PAUSE 10
- REPEAT
- UNTIL INKEY$<>"" OR MOUSEK
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE break.key
- ' *** this Procedure is called after : <Alternate> <Shift> <Control>
- ' *** activate with : On Break Gosub Break.key
- ' *** after activating, you can't enter the GFA-editor from the program !
- LOCAL m$,b$,k
- ON BREAK CONT
- m$=" abort this| program| or| continue ?"
- b$="STOP|CONT"
- ALERT 3,m$,2,b$,k
- IF k=1
- IF EXIST("\START.GFA")
- CHAIN "\START.GFA"
- ELSE IF EXIST("\STARTLOW.GFA")
- CHAIN "\STARTLOW.GFA"
- ELSE
- EDIT
- ENDIF
- ENDIF
- ON BREAK GOSUB break.key
- RETURN
- ' **********
- '
- > PROCEDURE initio.keyget
- ' *** flexible processing of any keypress
- ' *** in program : DO
- ' KEYGET get.code%
- ' @keyget ! process keypress there
- ' LOOP
- '
- ABSOLUTE ascii|,V:get.code%+3 ! ASCII-code of key
- ABSOLUTE scan|,V:get.code%+1 ! scan-code of key
- ABSOLUTE status|,V:get.code% ! bit 0 = Right <Shift>, 1 = Left <Shift>
- ' 2 = <Control>, 3 = <Alternate>, 4 = <CapsLock>
- RETURN
- ' ***
- > PROCEDURE keyget
- ' *** process keypress here
- {XBIOS(14,1)+6}=0 ! empty keyboard-buffer before leaving
- RETURN
- ' **********
- '
- > PROCEDURE initio.macro
- ' *** install strings as macro for function-keys
- ' *** strings may not exceed 31 characters
- LOCAL i,macro$
- KEYPAD &X10000 ! KEYDEF without <Alternate> activated; in editor you
- RESTORE initio.macro ! still have to press <Alternate> !
- FOR i=1 TO 20
- READ macro$
- KEYDEF i,macro$
- NEXT i
- '
- initio.macro:
- ' *** switch to Overwrite-mode of GFA-editor before entering text
- ' *** function-keys <F1> - <F10>
- DATA "F1 "
- DATA "F2 "
- DATA "F3 "
- DATA "F4 "
- DATA "F5 "
- DATA "F6 "
- DATA "F7 "
- DATA "F8 "
- DATA "F9 "
- DATA "F10 "
- ' *** function-keys <Shift> <F1> - <Shift> <F10>
- DATA "S F1 "
- DATA "S F2 "
- DATA "S F3 "
- DATA "S F4 "
- DATA "S F5 "
- DATA "S F6 "
- DATA "S F7 "
- DATA "S F8 "
- DATA "S F9 "
- DATA "S F10 "
- RETURN
- ' **********
- '
- > PROCEDURE keypress(txt$)
- ' *** simulates input of txt$ by user (including <Return>)
- ' *** call this Procedure before INPUT, FILESELECT, ALERT, etc.
- LOCAL i
- REPEAT
- UNTIL INKEY$="" ! clear keyboard-buffer
- FOR i=1 TO LEN(txt$)
- KEYPRESS ASC(MID$(txt$,i))
- NEXT i
- KEYPRESS &H1C000D ! <Return>
- RETURN
- ' **********
- '
-